package net.goutalk.glcs.module.print.controller;

import net.goutalk.glcs.common.constant.GlobalConstant;
import net.goutalk.glcs.common.model.result.R;
import net.goutalk.glcs.module.print.dto.PrintConfigInfoDto;
import net.goutalk.glcs.module.print.dto.PrintSetConfigDto;
import net.goutalk.glcs.module.print.service.IPrintConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tanyujie
 * @since 2023-05-23
 */
@RestController
@RequestMapping(GlobalConstant.PRINT_MODULE_PREFIX + "/config")
@Api(value = GlobalConstant.PRINT_MODULE_PREFIX + "/config", tags = "打印配置模块")
@AllArgsConstructor
public class PrintConfigController {

    private final IPrintConfigService printConfigService;

    @PostMapping
    @ApiOperation(value = "设置打印按钮配置")
    public R set(@Valid @RequestBody PrintSetConfigDto dto){
        return R.ok(printConfigService.setConfig(dto));
    }

    @GetMapping("/info")
    @ApiOperation(value = "获取打印按钮配置")
    public R info(@Valid PrintConfigInfoDto dto){
        return R.ok(printConfigService.getInfo(dto));
    }

}
